﻿#parse("partials/header.html") #parse("partials/sidebar.html")
<script type="text/javascript">
    $(document).ready(function () {

        jQuery(".deleteconfirm").live('click', function (event) {
            var deleteid = $(this).attr("deleteid");
            DeleteConfirm(deleteid);
        });

        function DeleteConfirm(id) {
            $("#dialog-confirm").dialog({
                resizable: false,
                height: 160,
                modal: true,
                buttons: {
                    "Yes": function () {
                        jQuery.ajax({
                            type: "GET",
                            url: "/master/employees/deleteemployee/?id=" + id,
                            cache: false,
                            success: function (data) {
                                $("#notif").html(data);
                                oTable.fnDraw();
                            },
                            error: function (data) {
                            },
                            complete: function () {
                            }
                        });
                        $(this).dialog("close");
                    },
                    Cancel: function () {
                        $(this).dialog("close");
                    }
                }
            });
        }


        var oTable = $('#datalist').dataTable({
            "bSort": false,
            "sPaginationType": "full_numbers",
            "bProcessing": true,
            "bServerSide": true,

            "sAjaxSource": rooturl + "/master/employees/tablelist",
            "aoColumns": [
                             { "mDataProp": "Id" },
                             { "mDataProp": "EmployeeNumber" },
                             { "mDataProp": "SuperiorNumber" },
                             { "mDataProp": "fullname" },
                             { "mDataProp": "gender" },
                             { "mDataProp": "departement" },
                             { "mDataProp": "hospital" }

                        ],
            "aoColumnDefs": [
                                {
                                    "fnRender": function (o) {
                                        //                                                              
                                        return "<center> <a class='tooltip' title='Edit Record' href='/master/employees/editemployee/?id=" + o.aData['Id'] + "' ><img src='/images/Icons/pencil.png'/></a><a class='deleteconfirm' style='cursor:pointer' title='Delete Record' deleteid='" + o.aData['Id'] + "'><img src='/images/Icons/eraser.png'/></a></center>";
                                    },
                                    "aTargets": [0]
                                }
                        ],
            "fnServerData": function (sSource, aoData, fnCallback) {
                aoData.push({ "name": "TextboxEmployeeNumber", "value": $('#TextboxEmployeeNumber').val() });
                aoData.push({ "name": "fullname", "value": $('#fullname').val() });
                aoData.push({ "name": "HospitalUnitId", "value": $('#HospitalUnitId').val() });
                jQuery.ajax({
                    "dataType": 'json',
                    "type": "GET",
                    "url": rooturl + "master/employees/tablelist",
                    "data": aoData,
                    "success": fnCallback
                });
            }
        }).fnSetFilteringPressEnter();

        function checkForEnter(event) {
            if (event.keyCode == 13) {
                oTable.fnDraw();
            }
        }
        $('#TextboxEmployeeNumber').keypress(checkForEnter);
        $('#fullname').keypress(checkForEnter);
        $('#buttonSearch').click(function () {
            oTable.fnDraw();
        });

    });
  

</script>
<style>
    div#datalist_filter 
    {
        display:none;
    }
    div#datalist_length 
    {
        display:none;
    }
    .mws-table thead 
    {
        margin-top:-10px;
    }
</style>

<div id="mws-container" class="clearfix">
    <!-- Inner Container Start -->
    <div class="container">
        <!-- Panels Start -->
        <div class="mws-panel grid_8">
            <div class="mws-panel-header">
                <span class="mws-i-24 i-table-1">$Pagetitle</span>
            </div>
            <div class="mws-panel-body">
                <div class="mws-panel-toolbar top clearfix">
                    <ul>
                            
                             <li><a class="mws-ic-16 ic-add" href="/master/employees/createemployee/" title="Accept">
                            Add Employee</a></li>
                       </ul>
                </div>
                 <div id="notif">
                </div>
                <br />
                <div class="mws-form" action="#">
                    <div class="mws-form-inline">
                        <div class="mws-form-row">
                             <label>
                                  Employee Number</label>
                            <div class="mws-form-item large">
                                <div class="mws-form-cols clearfix">
                                    <div class="mws-form-col-2-8 alpha">
                                       <div class="mws-form-item">
                                           <input id="TextboxNameValue" type="TextboxNameValue" class="mws-textinput" />
                                        </div>
                                    </div>
                                </div>
                            </div>
                        </div>
                         <div class="mws-form-row">
                             <label>
                                  Full Name</label>
                            <div class="mws-form-item large">
                                <div class="mws-form-cols clearfix">
                                    <div class="mws-form-col-2-8 alpha">
                                       <div class="mws-form-item">
                                           <input id="fullname" type="fullname" class="mws-textinput" />
                                        </div>
                                    </div>
                                </div>
                            </div>
                        </div>
                     <div class="mws-form-row">
                             <label>
                                  Location</label>
                            <div class="mws-form-item large">
                                <div class="mws-form-cols clearfix">
                                    <div class="mws-form-col-2-8 alpha">
                                       <div class="mws-form-item">
                                          $ddlLocation2
                                        </div>
                                    </div>
                                </div>
                            </div>
                        </div>
                        
                    </div>
                    <br />
                    <div class="mws-button-row">
                        <input id="buttonSearch" type="submit" value="Search" class="mws-button red" />
                    </div>
                </div>
                
                <table cellpadding="0" cellspacing="0" border="0" class="mws-table" id="datalist"
                    width="80%">
                    <thead>
                         <tr>
                       <th style="text-align: center;width:4%">
                                Actions
                            </th>
                              <th style="text-align: center;width:11%">
                              Employee Number
                          <th style="text-align: center;width:11%">
                             Superior Number
                            </th>
                          <th style="text-align: center;width:15%">
                              Full Name
                            </th>
                           <th style="text-align: center;width:4%">
                              Gender
                            </th>
                           <th style="text-align: center;width:15%">
                              Department
                            </th>
                            <th style="text-align: center;width:20%">
                              Hospital Unit
                            </th>
                        </tr>
                    </thead>
                    <tbody>
                        <tr>
                            <td colspan="7" class="dataTables_empty">
                                
                            </td>
                        </tr>
                    </tbody>
                </table>
            </div>
        </div>
        <!-- Panels End -->
    </div>
    <!-- Inner Container End -->
</div>
<!--mws-container End-->
<div id="dialog-confirm" title="Delete Confirmation" style="display: none">
        <p>
        </p>
        <p>
            <span class="ui-icon ui-icon-alert" style="float: left; margin: 5px 7px 20px 40px;">
            </span>Are you sure want to delete this record?</p>
    </div>
#parse("partials/footer.html")


